import trees
import matplotlib.pyplot as plt
import treePlotter

myDat, labels = trees.createDataSet()

print(myDat)
#  print(trees.calcShannonEnt(myDat))
#  print(myDat[0][-1])

#  print(trees.splitDataSet(myDat, 0, 1))

#  print(trees.chooseBestFeatureToSplit(myDat))
#  print(trees.createTree(myDat, labels))

#  treePlotter.createPlot()

#  print(treePlotter.retrieveTree(1))
#  myTree = trees.createTree(myDat, labels)
#  myDat, labels = trees.createDataSet()
#  print(trees.classify(myTree, labels, [1, 0]))

fr = open('./lenses.txt')
lenses = [inst.strip().split('\t') for inst in fr.readlines()]
lensesLabels = ['age', 'prescript', 'astigmatic', 'tearRate']
lensesTree = trees.createTree(lenses, lensesLabels)
print(lensesTree)
